//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __DDKTSTMEMORY_H__
#define __DDKTSTMEMORY_H__

typedef enum MemTstCommand
{
    MemTst_DzAllocPages = 1,
    MemTst_DzFreePages,
    MemTst_DzAllocPage,
    MemTst_DzFreePage,
    MemTst_DzAllocKernelPages,
    MemTst_DzFreeKernelPages,
    MemTst_DzAllocKernelPage,
    MemTst_DzFreeKernelPage,
    MemTst_DzIoRemap,
    MemTst_DzIoUnmap,
    MemTst_DzKIoRemap,
    MemTst_DzKIoUnmap,
    MemTst_malloc,
    MemTst_free,
    MemTst_new,
    MemTst_delete,
} MemTstCommand;

// ZoneType
#define Use_Dma_Zone 0
#define Use_Kernel_Zone 1
#define Use_User_Zone 2
// ZoneType

typedef struct _Control_Pack
{
    int         FuncNo;
    uint_t      uOrder;
    int         ZoneType;
    physaddr_t  pa;
    virtaddr_t  va;
    size_t      size;
    uint_t      uIndex;
    char        nbyte[4];
} ControlPack, *PControlPack;

//global
#define ALLOC_MAX_NUM 4000

//func about ddktstmemory.cpp
ulong_t Rand();
Boolean AllocFun(ControlPack * pArgPack);
void FreeAllAllocMem();
void FreeFun(ControlPack * pArgPack);
void ReadPages(ControlPack   *pArgPack);
void WritePages(ControlPack   *pArgPack);

//func about ddktstalloc.cpp
void AllocPagesFun1(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun2(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun3(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun4(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun5(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun6(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun7(Int32 nControlCode, PControlPack pControlPack);
void AllocPagesFun9(Int32 nControlCode, PControlPack pControlPack);

void AllocPageFun1(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun2(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun3(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun4(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun5(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun6(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun7(Int32 nControlCode, PControlPack pControlPack);
void AllocPageFun9(Int32 nControlCode, PControlPack pControlPack);

void AllocKPagesFun1(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun2(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun3(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun4(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun5(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun6(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun7(Int32 nControlCode, PControlPack pControlPack);
void AllocKPagesFun9(Int32 nControlCode, PControlPack pControlPack);

void AllocKPageFun1(Int32 nControlCode, PControlPack pControlPack);
void AllocKPageFun2(Int32 nControlCode, PControlPack pControlPack);
void AllocKPageFun3(Int32 nControlCode, PControlPack pControlPack);
void AllocKPageFun4(Int32 nControlCode, PControlPack pControlPack);
void AllocKPageFun6(Int32 nControlCode, PControlPack pControlPack);

Boolean mallocFun1();
Boolean mallocFun2();
Boolean mallocFun3();
Boolean mallocFun4();
Boolean mallocFun5();

Boolean IoRemapFun1();
Boolean IoRemapFun2();
Boolean IoRemapFun3();
Boolean IoRemapFun4();
Boolean IoRemapFun5();
Boolean IoRemapFun6();
Boolean IoRemapFun7();
Boolean IoRemapFun8();
Boolean IoRemapFun9();
Boolean IoRemapFun10();
Boolean IoRemapFun11();
Boolean IoRemapFun12();
Boolean IoRemapFun13();
Boolean IoRemapFun14();
Boolean IoRemapFun15();
Boolean IoRemapFun16();

Boolean KIoRemapFun1();
Boolean KIoRemapFun2();
Boolean KIoRemapFun3();
Boolean KIoRemapFun4();
Boolean KIoRemapFun5();
Boolean KIoRemapFun6();

#endif // __DDKTSTMEMORY_H__
